﻿using System;
using System.ComponentModel.DataAnnotations;
using KL.UFrame.Core.Configuration;

namespace KL.UFrame.Data.Models.Account
{
    /// <summary>
    /// 用户信息模型
    /// By：杨超
    /// </summary>
    public class UserInfoModel
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 登录名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        /// Email可为空，注意使用前必须判断EmailConfirmed==true
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 指示Email是否已经确认
        /// </summary>
        public bool EmailConfirmed { get; set; }

        /// <summary>
        /// 用户昵称
        /// </summary>
        public string Nickname { get; set; }

        /// <summary>
        /// 用户关联的微信OpenId
        /// </summary>
        public string WechatOpenId { get; set; }

        /// <summary>
        /// 为true时，用户被锁定，无法登录
        /// </summary>
        public bool LockoutEnabled { get; set; }

        public string HeadImageUrl { get; set; }

        public DateTimeOffset RegisterTime { get; set; }
    }

    public class UserRegisterModel
    {
        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "手机号")]
        public string UserName { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "密码")]
        [DataType(DataType.Password)]
        public string Password { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "电子邮件")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }
    }

    public class ChangePasswordModel
    {
        public string UserName { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "密码")]
        [DataType(DataType.Password)]
        public string Password { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "新密码")]
        [DataType(DataType.Password)]
        public string NewPassword { get; set; }
    }

    public class ResetPasswordModel
    {
        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "用户名")]
        public string UserName { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "密码")]
        [DataType(DataType.Password)]
        public string Password { get; set; }


        [Required(ErrorMessage = "{0}不能为空")]
        [Display(Name = "验证码")]
        public string Code { get; set; }
    }

    public class UserRoleModel
    {
        /// <summary>
        /// 角色名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 是否授权
        /// </summary>
        public bool Authorized { get; set; }
    }
}